package com.itheima02.day07;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

/**
 * @author 刘全
 * @date 2021/7/24
 */
public class ThrowException {
    public static void main(String[] args) throws ParseException {
        Scanner sc = new Scanner(System.in);
        try {
            System.out.println("请输入:");
            String s = sc.nextLine();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date d = sdf.parse(s);
            System.out.println("解析成功");
        } catch (ParseException e) {
            System.out.println("解析异常");
        }
    }
}
